package com.nsl.my_youlai.controller;


import com.nsl.my_youlai.common.result.Result;
import com.nsl.my_youlai.config.ProjectPathSetting;
import com.nsl.my_youlai.model.dto.LoginResult;
import com.nsl.my_youlai.service.AuthService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/v1/auth")
@RequiredArgsConstructor
@Slf4j
public class AuthController {


    private final AuthService authService;


    @PostMapping("/login")
    public Result<LoginResult> login(
            @RequestParam String username,
            @RequestParam String password
    ) {
//        login("username = {}",username);
//        login("password = {}",password);
        System.out.println(username);
        System.out.println(password);
        LoginResult loginResult = authService.login(username, password);
        return Result.success(loginResult);
    }

//    @Operation(summary = "注销")
//    @DeleteMapping("/logout")
//    public Result logout() {
//        authService.logout();
//        return Result.success();
//    }
//
//    @Operation(summary = "获取验证码")
//    @GetMapping("/captcha")
//    public Result<CaptchaResult> getCaptcha() {
//        CaptchaResult captcha = authService.getCaptcha();
//        return Result.success(captcha);
//    }

}
